<%@page	import="java.io.*, com.itextpdf.text.*, com.itextpdf.text.pdf.*"%>
<%
	response.setContentType("application/pdf");
	float oneMM = (float) (72 / 25.4);
	
	// step 1:
	Document document = new Document(new Rectangle(231 * oneMM, 126 * oneMM));
	// step 2:
	ByteArrayOutputStream buffer = new ByteArrayOutputStream();
	PdfWriter writer = PdfWriter.getInstance(document, buffer);
	// step 3:
	document.open();
	
	writer.setCompressionLevel(0);
    // writes something to the direct content using a convenience method
    Phrase hello = new Phrase("Hello World");
    PdfContentByte canvas = writer.getDirectContentUnder();
    ColumnText.showTextAligned(canvas, Element.ALIGN_JUSTIFIED, hello, 0, 0, 0);
        // step 5  
	// step 5:
	document.close();
	// we output the writer as bytes to the response output
	DataOutput output = new DataOutputStream(response.getOutputStream());
	byte[] bytes = buffer.toByteArray();
	response.setContentLength(bytes.length);
	for (int i = 0; i < bytes.length; i++) {
		output.writeByte(bytes[i]);
	}
	out.clear();
%>